package com.dyna.foundation.utils;

import com.dyna.foundation.domain.entity.SysDictData;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * 字典工具类
 */
public class DictUtil {

    /**
     * 字典labelMap
     */
    public static Map<Integer, String> toDictLabelMap(List<SysDictData> dictData) {
        return dictData.stream().collect(Collectors.toMap(SysDictData::getDictId, SysDictData::getDictLabel));
    }

    /**
     * 字典value/label Map
     */
    public static Map<String, String> toDictValueLabelMap(List<SysDictData> dictData) {
        return dictData.stream().collect(Collectors.toMap(SysDictData::getDictValue, SysDictData::getDictLabel));
    }

}
